import { showToast } from "utils/index";
// const behav = require("../behavior");
Component({
  // behaviors: [behav],
  externalClasses: ["move-item-one"],
  options: {
    styleIsolation: "apply-shared",
  },
  properties: {
    list: {
      type: Array,
      value() {
        return [];
      },
    },
  },

  data: {
    newList: [],
  },
  observers: {
    list(newVal = []) {
      console.log(newVal, "newVal-----------");
      newVal = newVal.map((item) => {
        item.singers = item.artists.map((it) => it.name).join(" - ");
        return item;
      });
      this.setData({
        newList: newVal,
      });
    },
  },
  methods: {
    onPlay(e) {
      const { id } = e.currentTarget.dataset;
      this.triggerEvent("play", { id });
    },
  },
});
